#include<iostream>
#include<algorithm>
using namespace std;
const int N = 1e3 + 10;
int a[N], b[N];
int n, m;
int cmp(int a, int b)
{
	return a > b;
}
int main()
{
	cin >> n;
	for (int i = 1; i <= n; i++) {
		cin >> a[i];
	}
	cin >> m;
	while (m--) {
		int l, r, k;
		cin >> l >> r >> k;
		int z = 0;
		for (int i = l; i <= r; i++) {
			b[z++] = a[i];
		}
		sort(b, b + z);
		cout << b[z - k] << endl;
	}
	return 0;
}